<template>
    <view style="display: flex;align-items: center;justify-content: center;height: 100vh;background-color: #F2F4F7;">
       <view v-if="erweimapath">
		   <cc-poster ref="mySon" @success="posterSuccess" :imgSrc="goods.itempic" :QrSrc="erweimapath"
		       :Title="user_info.username" :Referrer="goods.itemdesc" :PriceTxt="goods.itemendprice" :OriginalTxt="goods.itemprice"
		       :LineType="false" :ViewDetails="goods.ViewDetails" :profilePicture="user_info.photo"></cc-poster>
			   <view class="bacshun" @click="fatherClick">
				   保存到相册
			   </view>
	   </view>
    </view>
</template>
<script>
	import ccPoster from "@/uni_modules/cc-poster/components/cc-poster/cc-poster.vue"
	import _data from '../../common/_data';
	// import 
	// cc-poster
    //高德SDK
    export default {
		components:{
			ccPoster
		},
        data() {
            return {
                haibaoImg: null,
                modalName: '',
				user_info:{},
                haibaoShow: false,
				a:require('@/static/mesh-810.png'),
                erweimapath: "",
                goods: {
                    "itemid": "2nNozWXiotnRwxGUakBuXUD-0npyN5GSNmYDb0pgTxw",
                    "itemtitle": "长按扫码加入群聊",
					"ViewDetails": "长按扫码加入群聊",
                    "itemshorttitle": "这里是用户昵称",
                    "itemdesc": "邀请你加入<全国甩单总群>",
                    "itemprice": "39.90",
                    "todaysale": "3",
                    "itempic": "https://im.numtwin.com/static/img/fxpic.jpg",
                    "itemendprice": "29.91",
                }

            };
        },

        onLoad() {
			let user_info=uni.getStorageSync('user_info');
			if(user_info){
				this.user_info=JSON.parse(user_info);
			}
			this.getWxAcodeunLimit()
        },
        methods: {
			
			getWxAcodeunLimit(){
				let _thjis=this;
				// /im/user/getWxAcodeunLimit
				this.$httpSend({
				  path: '/im/user/getWxAcodeunLimit',
				  data: { rcode: this.user_info.referral_code,
					isComens:true,
				  },
				  success (res) {
					  _thjis.erweimapath=res;
					  // console.log(res)
				  }
				});
			},
			fatherClick() {
			this.$refs.mySon.toSave("father call son");
		  },
            posterSuccess(haibaoImg) {
                this.haibaoImg = haibaoImg;
                this.modalName = 'Image';
            },
            showModal() {
                if (!this.haibaoImg) {
                    this.haibaoShow = true;

                    uni.showLoading({
                        title: '海报生成中...'
                    });

                } else {
                    this.modalName = 'Image';
                }
            },
            hideModal() {
                this.modalName = null;
            }

        }
    };
</script>
<style lang="scss">
    .cu-modal {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1110;
        opacity: 0;
        outline: 0;
        text-align: center;
        -ms-transform: scale(1.185);
        transform: scale(1.185);
        backface-visibility: hidden;
        perspective: 2000upx;
        background: rgba(0, 0, 0, 0.6);
        transition: all 0.3s ease-in-out 0s;
        pointer-events: none;
    }

    .cu-modal::before {
        content: "\200B";
        display: inline-block;
        height: 100%;
        vertical-align: middle;
    }

    .cu-modal.show {
        opacity: 1;
        transition-duration: 0.3s;
        -ms-transform: scale(1);
        transform: scale(1);
        overflow-x: hidden;
        overflow-y: auto;
        pointer-events: auto;
    }

    .cu-dialog {
        position: relative;
        display: inline-block;
        vertical-align: middle;
        margin-left: auto;
        margin-right: auto;
        width: 680upx;
        max-width: 100%;
        background-color: #f8f8f8;
        border-radius: 10upx;
        overflow: hidden;
    }
	.bacshun{
		width: 284rpx;
		height: 80rpx;
		text-align: center;
		line-height: 80rpx;
		background: #256FF3;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 0 auto;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #FFFFFF;
		text-align: center;
		font-style: normal;
		margin-top: 40rpx;
		text-transform: none;
	}
</style>